<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">

<head>
    <th:block th:include="common/common_head :: commonHeader('供应商资质证书')"/>
    <link th:href="@{/static/css/plugins/cropper/cropper.min.css}" rel="stylesheet">
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <form class="form-horizontal" method="post" id="vendorCertificateForm">
        <div class="row">
            <div class="form-group">
                <div class="col-sm-8" style="margin-left: 16px">
                    <input class="btn btn-primary" type="button" onclick="save()" value="保存">
                    <button class="btn btn-primary" type="button" onclick="Dialog.closeFrame(window.name)">取 消</button>
                </div>
            </div>
            <div class="form-group">
            
               <div class="ibox float-e-margins">
                 <div class="ibox-title">
                        <h5 style="padding-left:15px;">附件信息</h5>
                 </div>
                 <div class="ibox-content">
					<div class="form-group">
					  <ul>
					      <li class="col-sm-3" style="width: 25%">
					          <label class="col-sm-1 control-label" style="width: 40%">供应商名称：</label>
					          <div class="col-sm-3" style="width: 60%">
					              <select class="form-control" id="vendorName" name="vendorId" style="width: 99%"></select>
					          </div>
					     </li>
					     <li class="col-sm-3" style="width: 25%">
					          <label class="col-sm-1 control-label" style="width: 40%">体系证书认证资质：</label>
					          <div class="col-sm-3" style="width: 60%">
					              <input name="certificationQualification" type="text" placeholder="体系证书认证资质" class="form-control" style="width: 99%" />
					          </div>
					     </li>
					     <li class="col-sm-3" style="width: 25%">
					          <label class="col-sm-1 control-label" style="width: 40%">体系证书有效期起：</label>
					          <div class="col-sm-3" style="width: 60%">
					              <input name="validityPeriodRise" id="validityPeriodRise" type="text" placeholder="体系证书有效期起" class="form-control" style="width: 99%" />
					          </div>
					     </li>
					     <li class="col-sm-3" style="width: 25%">
					          <label class="col-sm-1 control-label" style="width: 40%">体系证书有效期止：</label>
					          <div class="col-sm-3" style="width: 60%">
					              <input name="validityPeriodStop" id="validityPeriodStop" type="text" placeholder="体系证书有效期止" class="form-control" style="width: 99%" />
					           </div>
					      </li>
					  </ul>
					</div>
                  </div>
               </div>
            </div>
      </div>
   </form>
</div>

<!--引入公共js-->
<div th:include="common/onload_js :: onloadJS"></div>
<!-- Chosen -->
<script th:src="@{/static/js/plugins/chosen/chosen.jquery.js}"></script>
<script type="text/javascript">
    $(function () {
        // 初始化时间插件
        laydate.render({elem: '#validityPeriodRise'});
        laydate.render({elem: '#validityPeriodStop'});
        
        //自动往select框里面填充字典数据
        var sels = $("#vendorName");
		Page.ajaxGET(ctxPath + "/vendor/findSimpleAll", {},function(o) {
			var res = o.result;
            for(var k in res){
            	sels.append("<option value='"+k+"'>"+res[k]+"</option>");// 添加option
            }
		}, {
			async : false
		});
    });
    
    function save() {
    	//回填下拉数据
        if($("#vendorCertificateForm").valid()) {
            Page.ajaxPOST(ctxPath + "/vendorCertificate/saveSingle", $('#vendorCertificateForm').serialize(), function (res) {
                Dialog.msg("新增成功!",function(){
                	parent.refresh();
                    Dialog.closeFrame(window.name);
                });
            }, {"loadingMsg" : "正在往服务器提交数据……"});
        }
    }
</script>

</body>
</html>
